package com.eflock.controller;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.eflock.dto.CategoriaDTO;
import com.eflock.service.CategoriaService;

public class CategoriaController implements Controller {
	
	private CategoriaService categoriaService;

    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
    	CategoriaDTO cat = categoriaService.getCategoria(1);
    	
    	Map<String, CategoriaDTO> result = new HashMap<String,CategoriaDTO>();
    	result.put("categoria", cat);
        return new ModelAndView("categorias_index", result);
    }

	public CategoriaService getCategoriaService() {
		return categoriaService;
	}

	public void setCategoriaService(CategoriaService catService) {
		this.categoriaService = catService;
	}


}